//
//   textReader.app -  kludged up by Jim Beesley
//   This incorporates inspiration, code, and examples from (among others)
//   * The iPhone Dev Team for toolchain and more!
//   * James Yopp for the UIOrientingApplication example
//   * Paul J. Lucas for txt2pdbdoc
//   * http://iphonedevdoc.com/index.php - random hints and examples
//   * mxweas - UITransitionView example
//   * thebends.org - textDrawing example
//   * Books.app - written by Zachary Brewster-Geisz (and others)
//   * "iPhone Open Application Development" by Jonathan Zdziarski - FileTable/UIDeletableCell example
//   * http://garcya.us/ - for application icons
//   * Allen Li for help with rotation lock and swipe/gestures
//
//   This program is free software; you can redistribute it and/or
//   modify it under the terms of the GNU General Public License
//   as published by the Free Software Foundation; version 2
//   of the License.
//
//   This program is distributed in the hope that it will be useful,
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//   GNU General Public License for more details.
//
//   You should have received a copy of the GNU General Public License
//   along with this program; if not, write to the Free Software
//   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
//



#import "MyPreferencesTable.h"
#import "FontSelectViewController.h"
#import "EncodingSelectViewController.h"
#import "ColorPickerViewController.h"




static const int kUIControlEventMouseUpInside = 1 << 6;

NSString  *TextAlignmentNames[6];


// **********************************************************************
// Class for Preferences Page
@implementation MyPreferencesTable
@synthesize textView;

- (IBAction)fontNameAction:(id)sender
{
	FontSelectViewController *fontSelectVC = [[FontSelectViewController alloc] initWithStyle:UITableViewStyleGrouped];
	fontSelectVC.delegate = self;
	[self presentModalViewController:fontSelectVC animated:YES];
	[fontSelectVC release];
}
- (IBAction)fontSizeAction:(id)sender
{
}
- (IBAction)encodingAction:(id)sender
{
}
- (IBAction)bgColorAction:(id)sender
{
	
}
- (IBAction)textColorAction:(id)sender
{
}
#pragma mark FontSelectDelegate

- (void)didSelectFont:(NSString *)fontname
{
	
}

- (void) setEncoding:(NSString*)enc
{}


- (void) setTextReader:(textReader*)tr {
    trApp = tr;
} // setTextReader

// Save the encodings
-(void)saveEncodings {


} // saveEncodings


// Save the font/size
- (bool) saveFont:(NSString*)font size:(int)size {
    return [textView setFont:font size:size];
} // saveFont


- (void) setFont:(NSString*)font {

} // setFont


- (void) setFontSize:(NSString*)fontSize {

} // setFontSize


- (IBAction)saveAction:(id)sender
{
	[self saveFont:nil size:[fontSizeBtn.text intValue]];
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
	[textField resignFirstResponder];
	return YES;
}
#pragma mark -
#pragma mark Picker View Methods

- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)thePickerView 
{
	
	return 1;
}

- (NSInteger)pickerView:(UIPickerView *)thePickerView numberOfRowsInComponent:(NSInteger)component {
	
	return [arrayColors count];
}

- (NSString *)pickerView:(UIPickerView *)thePickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {
	
	return [arrayColors objectAtIndex:row];
}

- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
}


- (void)viewDidLoad {
	[super viewDidLoad];
	
	// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
	// self.navigationItem.rightBarButtonItem = self.editButtonItem;
	arrayColors = [[NSMutableArray alloc] init];
	[arrayColors addObject:@"Black"];
	[arrayColors addObject:@"White"];
	[arrayColors addObject:@"Brown"];
	[arrayColors addObject:@"Green"];
	[arrayColors addObject:@"Blue"];
	[arrayColors addObject:@"Red"];
	
	//add save button
	fontSizeBtn.text = [NSString stringWithFormat:@"%d", [textView getFontSize]];
}


- (void)dealloc {
	[fontNameBtn release];
	[fontSizeBtn release];
	[encodingBtn release];
	[previewTextView release];
	[bgColorBtn release];
	[textColorBtn release];
	[arrayColors release];
  [super dealloc];
} // dealloc


@end



// **********************************************************************

